﻿package cn.antscript.airCMS.display.component 
{
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author antscript
	 */
	public class Tips extends Sprite
	{
		static private var _instance:Tips;
		private var _txt:TextField;
		
		public function Tips(privateClass:PrivateClass) 
		{
			_txt = new TextField();
			_txt.height = 20;
			_txt.x = 5;
			_txt.textColor = 0x333333;
			addChild(_txt);
		}
		
		public static function getInstance():Tips {
			if (_instance == null) {
				_instance = new Tips(new PrivateClass);
			}
			return _instance;
		}
		
		public function show(container:DisplayObjectContainer,label:String,xpos:int=-5,ypos:int=-25):void {
			
			
			
			container.addChild(Tips.getInstance());
			
			_txt.width = label.length * 15+10;
			_txt.text = label;
			
			this.x = xpos;
			this.y = ypos;
			
			
			Tips.getInstance().graphics.lineStyle(2, 0x333333);
			Tips.getInstance().graphics.beginFill(0xaaaaaa, 0.9);
			Tips.getInstance().graphics.drawRoundRect(0, 0, _txt.width, _txt.height, 3);
			Tips.getInstance().graphics.endFill();
		}
		public function hide():void {
			Tips.getInstance().parent.removeChild(Tips.getInstance());
		}
		
	}

}

class PrivateClass {
	
}